<%@include file="header.jsp" %>
<script type="text/javascript">
function flirt_sent()
{
alert("flirt sent!");
}
</script>
<%@ page import="java.util.ArrayList" %>
<%@ page import="Model.Notification" %>
<%
	if(session.getAttribute("loggedIn") != Boolean.TRUE) {
	%>
<meta HTTP-EQUIV="REFRESH" content="0; url=login.jsp">
<%} else {%>
<% Notification.checkNotifications(userID); %>
    <h1 id="title">Notifications</h1>

    <!-- Sub-navigation -->
    <p id="subnav">&nbsp;</p>
    <div class="content box">
        <div class="content-in box">
		<table>
                <tr>
                    <th></th>
                    <th>User</th>
                    <th></th>
                    <th>Send Message</th>
<!--                     <th>Set up date</th> -->
                </tr>
                	
                	<%
                	ArrayList<Notification> results = Notification.getNotifications(userID);
                	for(int i=0;i<results.size() && i <results.size(); i++) {
                		Notification result = results.get(i);
						int resultID = result.getFromID();
					%>
				         <tr <% if (i%2==0){%>class="odd"<%} %>>
				             <td><img src="userprofiles/<%=resultID %>.jpg" width="50" height="50"></td>
				             <td align="center"><a href="profile.jsp?id=<%=resultID%>"><%=User.getName(resultID) %></a></td>
		                    <td align="center"><%=result.getMsg() %></td>
		                    <td align="center">
		                    <form name="input" action="createMessage.jsp" method="get">
								<input type="hidden" id="toUser" name="toUser" value=<%=resultID%> />
								<input class="input-submit-small" type="submit" value="Message" />
							</form> 
							</td>
		                    <td align="center">
				            <form action="/UBCDatingServer/manageother" method="post">
				            <input type="hidden" name="userID" value="<%=userID%>" />
				            <input type="hidden" name="profileID" value="<%=resultID%>" />
							<input type="submit" name="button" value="Flirt!" class="input-submit" onclick="flirt_sent()" />
				            </form></td>
				         </tr>
					<%} %>
			</table>

        </div> 
      <!-- /content-in -->
        
      <div class="content-bottom"></div>

    </div> <!-- /content -->
<%} %>
<%@include file="footer.jsp" %>